define(["app","js/signature/formView","js/init", 'js/utils','js/util/socketUtil',"text!app/signature/base.html"], 
	function(app, formView,base,Utils,initSocket,baseform) {
	
	//当前配置信息缓存变量
		
	var curConfig = {
		
		code	: null,
		name	: null,
		subtitle: null
		
	} ;
	
	
	var bindings = [		
		//导航链接
		{
			element: '#form-page .back-link',
			event: 'click',
			handler: clickBack
		}	
		,
		
		//导航链接
		{
			element: '#form-page .save-link',
			event: 'click',
			handler: clickSave
		}
	];
	
	/**
	 * 回退按钮事件
	 */
	function clickBack(){
		if(!app.mainView){
			app = app.getApp();
		}
		
		var _cv = app.f7.getCurrentView();

		if(_cv && _cv.router){
			_cv.router.load({pageName:'signature/type'});
		}
	}
	
	/**
	 * 保存事件
	 */
	function clickSave(){
		
		
	}
	
	
	function init(query){	
		
		if(!app.mainView){
			app = app.getApp();
		};
		
		if(query){
			$.extend(curConfig,query);
		}
		
		if(!curConfig.subtitle){
			var usr = app.getUser();
			if(usr && usr.retData){
				curConfig.subtitle =usr.retData.deptName + '<span style="padding-left:20px;">' + usr.retData.name +'</span>';
			}
		}
		if(curConfig.name){
			$('#form-page .biz-media').attr('src','img/png/signature/'+curConfig.code+'-blue.png');
			$('#form-page .biz-title').html(curConfig.name);
			$('#form-page .biz-subtitle').html(curConfig.subtitle);
		}
		formView.render({
			
			bindings: bindings
		});
		
		app.f7.hidePreloader();
	}
	

	return {
		init: init
	};
});